翻訳と辞書
Words near each other
・ Tailwind (Transformers)
・ Tailwind Air Service
・ Tailwind Airlines
・ Tailypo
・ Tail lift
・ Tail Lights Fade
・ Tail number
・ Tail o' the Pup
・ Tail of a Tiger
・ Tail of Hope
・ Tail of pancreas
・ Tail of Spence
・ Tail of the Bank
・ Tail of the Moon
・ Tail of the Sun
Tail recursive parser
・ Tail risk
・ Tail risk parity
・ Tail rotor
・ Tail Schoonjans
・ Tail sequence
・ Tail Spin
・ Tail Sting
・ Tail suspension test
・ Tail Swallower and Dove
・ Tail to Nose
・ Tail value at risk
・ Tail vein
・ Tail warning radar
・ Tail-chase engagement


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Tail recursive parser : ウィキペディア英語版
Tail recursive parser
In computer science, tail recursive parsers are a derivation from the more common recursive descent parsers. Tail recursive parsers are commonly used to parse left recursive grammars. They use a smaller amount of stack space than regular recursive descent parsers. They are also easy to write. Typical recursive descent parsers make parsing left recursive grammars impossible (because of an infinite loop problem). Tail recursive parsers use a node reparenting technique that makes this allowable.
==Example==
Given an EBNF Grammar such as the following:
E: T
T: T | F
F: F | I
I:
A simple tail recursive parser can be written much like a recursive descent parser. The typical algorithm for parsing a grammar like this using an Abstract syntax tree is:
#Parse the next level of the grammar and get its output tree, designate it the first tree, F
#While there is terminating token, T, that can be put as the parent of this node:
##Allocate a new node, N
##Set N's current operator as the current input token
##Advance the input one token
##Set N's left subtree as F
##Parse another level down again and store this as the next tree, X
##Set N's right subtree as X
##Set F to N
#Return N
A C programming language implementation of this parser is shown here:

#include
#include
#include
#include
#include
enum node_type
;
typedef struct _exptree exptree;
struct _exptree ;
struct _lexval lexval;
int line_number = 0;
FILE
*fs,
*fd;
exptree
*parse_e(void);
exptree
*parse_t(void);
exptree
*parse_f(void);
exptree
*parse_i(void);
void next_token()

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Tail recursive parser」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.